Gnus can save articles in a
number of ways. Below is the documentation for saving articles in
a fairly straight-forward fashion (i.e., little processing of the
article is done before it is saved). For a different approach
(uudecoding, unsharing) you should use gnus-uu (see
Decoding
Articles).
For the commands listed here, the target is a file. If you
want to save to a group, see the B c
(gnus-summary-copy-article) command (see Mail Group
Commands).
If
gnus-save-all-headers is non-nil, Gnus
will not delete unwanted headers before saving the article.
If the preceding
variable is nil, all headers that match the
gnus-saved-headers regexp will be kept, while the
rest will be deleted before saving.
gnus-summary-save-article).gnus-summary-save-article-mail).gnus-summary-save-article-rmail). This is mbox
since Emacs 23, Babyl in older versions.gnus-summary-save-article-file).gnus-summary-write-article-file).gnus-summary-save-article-body-file).gnus-summary-save-article-folder).gnus-summary-save-article-vm).gnus-summary-pipe-output). If given a symbolic
prefix (see Symbolic
Prefixes), include the complete headers in the piped
output. The symbolic prefix r is special; it lets
this command pipe a raw article including all headers. The
gnus-summary-pipe-output-default-command variable
can be set to a string containing the default command and
options (default nil).gnus-summary-muttprint-program.
(gnus-summary-muttprint).All these
commands use the process/prefix convention (see Process/Prefix).
If you save bunches of articles using these functions, you might
get tired of being prompted for files to save each and every
article in. The prompting action is controlled by the
gnus-prompt-before-saving variable, which is
always by default, giving you that excessive
prompting action you know and loathe. If you set this variable to
t instead, you'll be prompted just once for each
series of articles you save. If you like to really have Gnus do
all your thinking for you, you can even set this variable to
nil, which means that you will never be prompted for
files to save articles in. Gnus will simply save all the articles
in the default files.
You
can customize the gnus-default-article-saver
variable to make Gnus do what you want it to. You can use any of
the eight ready-made functions below, or you can create your
own.
gnus-summary-save-in-rmailgnus-rmail-save-name
variable to get a file name to save the article in. The default
is gnus-plain-save-name.gnus-summary-save-in-mailgnus-mail-save-name variable to get a file name to
save the article in. The default is
gnus-plain-save-name.gnus-summary-save-in-filegnus-file-save-name variable to get a file name to
save the article in. The default is
gnus-numeric-save-name.gnus-summary-write-to-filegnus-file-save-name variable to get a file name to
save the article in. The default is
gnus-numeric-save-name.gnus-summary-save-body-in-filegnus-file-save-name variable to
get a file name to save the article in. The default is
gnus-numeric-save-name.gnus-summary-write-body-to-filegnus-file-save-name variable to get a file name to
save the article in. The default is
gnus-numeric-save-name.gnus-summary-save-in-folderrcvstore from the MH
library. Uses the function in the
gnus-folder-save-name variable to get a file name
to save the article in. The default is
gnus-folder-save-name, but you can also use
gnus-Folder-save-name, which creates capitalized
names.gnus-summary-save-in-vmgnus-summary-save-in-pipenildefaultgnus-summary-pipe-output-default-command holds
or the command last used for saving.Non-nil value for RAW overrides
:decode and :headers properties
(see below) and the raw article including all headers will be
piped.
The symbol of each function may have the following properties:
:decodenil means save decoded articles.
This is meaningful only with
gnus-summary-save-in-file,
gnus-summary-save-body-in-file,
gnus-summary-write-to-file,
gnus-summary-write-body-to-file, and
gnus-summary-save-in-pipe.:functiongnus-prompt-before-saving is bound to
t and all articles are saved in a single file.
This is meaningful only with
gnus-summary-write-to-file and
gnus-summary-write-body-to-file.:headersgnus-save-all-headers and
gnus-saved-headers control what headers should be
saved.All
of these functions, except for the last one, will save the
article in the gnus-article-save-directory, which is
initialized from the SAVEDIR environment variable. This is
~/News/ by default.
As you can see above, the functions use different functions to find a suitable name of a file to save the article in. Below is a list of available functions that generate names:
gnus-Numeric-save-namegnus-numeric-save-namegnus-Plain-save-namegnus-plain-save-namegnus-sender-save-nameYou can have Gnus
suggest where to save articles by plonking a regexp into the
gnus-split-methods alist. For instance, if you would
like to save articles related to Gnus in the file
gnus-stuff, and articles
related to VM in vm-stuff,
you could set this variable to something like:
(("^Subject:.*gnus\\|^Newsgroups:.*gnus" "gnus-stuff")
("^Subject:.*vm\\|^Xref:.*vm" "vm-stuff")
(my-choosing-function "../other-dir/my-stuff")
((equal gnus-newsgroup-name "mail.misc") "mail-stuff"))
We see that this is a list where each element is a list that
has two elements—the match and the
file. The match can either be a string (in which case
it is used as a regexp to match on the article head); it can be a
symbol (which will be called as a function with the group name as
a parameter); or it can be a list (which will be
evaled). If any of these actions have a
non-nil result, the file will be used as
a default prompt. In addition, the result of the operation itself
will be used if the function or form called returns a string or a
list of strings.
You basically end up with a list of file names that might be used when saving the current article. (All “matches” will be used.) You will then be prompted for what you really want to use as a name, with file name completion over the results from applying this variable.
This variable is ((gnus-article-archive-name)) by
default, which means that Gnus will look at the articles it saves
for an Archive-name line and use that as a
suggestion for the file name.
Here's an example function to clean up file names somewhat. If you have lots of mail groups called things like ‘nnml:mail.whatever’, you may want to chop off the beginning of these group names before creating the file name to save to. The following will do just that:
(defun my-save-name (group)
(when (string-match "^nnml:mail." group)
(substring group (match-end 0))))
(setq gnus-split-methods
'((gnus-article-archive-name)
(my-save-name)))
Finally,
you have the gnus-use-long-file-name variable. If it
is nil, all the preceding functions will replace all
periods (‘.’)
in the group names with slashes (‘/’)—which means that the
functions will generate hierarchies of directories instead of
having all the files in the top level directory
(~/News/alt/andrea-dworkin
instead of ~/News/alt.andrea-dworkin.) This variable is
t by default on most systems. However, for
historical reasons, this is nil on Xenix and
usg-unix-v machines by default.
This function also affects kill and score file names. If this
variable is a list, and the list contains the element
not-score, long file names will not be used for
score files, if it contains the element not-save,
long file names will not be used for saving, and if it contains
the element not-kill, long file names will not be
used for kill files.
If you'd like to save articles in a hierarchy that looks something like a spool, you could
(setq gnus-use-long-file-name '(not-save)) ; to get a hierarchy
(setq gnus-default-article-saver
'gnus-summary-save-in-file) ; no encoding
Then just save with o. You'd then read this
hierarchy with ephemeral nneething
groups—G D in the group buffer, and the top
level directory as the argument (~/News/). Then just walk around to the
groups/directories with nneething.